#pragma once

#define TIMER_AVERAGE_FACTOR 5

class ClockSystem;

class Timer
{
	ClockSystem* clock;

	float prevDelta[TIMER_AVERAGE_FACTOR];

	float currentDelta;
	float currentAverageDelta;
	double totalTime;

	bool isRunning;
	float speed;

public:

	Timer(ClockSystem* ref);

	void Start();
	void Pause();
	void Reset();
	
	void Update();

public:

	float GetSpeed() { return speed; }

	void SetSpeed(float _speed) { speed = _speed; }

	float GetAvgDelta() { return currentAverageDelta; }

	float GetRealDelta() { return currentDelta; }

	double GetTotalTime() { return totalTime; }
};